package lock;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author mubei
 * @date 2021/11/20
 * @description
 */
public class TestPool {

    public static void main(String[] args) {
//ThreadPoolExecutor
        ExecutorService service = Executors.newFixedThreadPool(10);

        // 执行 runnable的
        service.execute(new MyThread());
        service.execute(new MyThread());
        service.execute(new MyThread());

        service.shutdown();
    }
}


class MyThread implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName());
        }

    }
}
